package org.monkeypuzzler.utils;

import java.io.File;
import java.io.IOException;
import java.util.Properties;


/**
 * Provides the necessary information to run.
 * @author csmith@monkeypuzzler.org
 */
public class ConfigurationFactory
{
	private static ConfigurationFactory instance = null;
	
	public static ConfigurationFactory getInstance() throws IOException
	{
		if (instance == null)
			instance = new ConfigurationFactory();
		
		return instance;
	}
	
	private Properties properties = new Properties();
	private File expectationStorage = null;
	
	private ConfigurationFactory() throws IOException
	{
		if (properties.isEmpty())
			properties.load(ConfigurationFactory.class.getClassLoader().getResourceAsStream("monkeypuzzler.properties"));
	}
	
	public File getExpectationStorage()
	{
		if (expectationStorage == null)
		{
			expectationStorage = new File(properties.getProperty("expectationDir"));
			expectationStorage.mkdirs();
		}
		return expectationStorage;
	}
}
